package com.tedu.weibo.common.result;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer status;
    private String msg;
    private Object data;

    public JsonResult(StatusCode status) {
        this.status = status.getStatusCode();
        this.msg = status.getMessage();
    }
    public JsonResult(StatusCode status,Object data){
        this(status);
        this.data=data;
    }
    public static JsonResult success(Object data){
        return new JsonResult(StatusCode.OPERATION_SUCCESS,data);
    }
    public static JsonResult success(){
        return success(null);
    }
}
